﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TrackSystem.IO.Utils
{
    public class ResultMsg
    {
        /// <summary>
        /// 返回信息
        /// </summary>
        public string Msg { get; set; }
        /// <summary>
        /// 返回成功失败标志
        /// </summary>
        public bool Flag { get; set; }
        /// <summary>
        /// 操作注释
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 操作数据
        /// </summary>
        public int Val { get; set; }

        /// <summary>
        /// 成功信息
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="content"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public static ResultMsg Succ(string msg, string content = "", int val = 0)
        {
            return new ResultMsg()
            {
                Msg = msg,
                Flag = true,
                Content = content,
                Val = val
            };
        }

        /// <summary>
        /// 失败信息
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="content"></param>
        /// <param name="val"></param>
        /// <returns></returns>
        public static ResultMsg Fail(string msg, string content = "", int val = 0)
        {
            return new ResultMsg()
            {
                Msg = msg,
                Flag = false,
                Content = content,
                Val = val
            };
        }
    }
}
